<?php
	require '../include/library.inc.php';
	require '../include/admin_login.inc.php';

$order_id = intval(($_GET['order_id'])?$_GET['order_id']:$_POST['order_id']);
if (!$order_id) redirect("orders.php");

		
	$sql = 'SELECT
				o.start_date,
  				o.duration,
  				o.tuition,
				o.registration_fee,
				o.housing,
				o.order_status_id,
				o.creation_datetime AS application_datetime,
				u.*,
				s.name AS school_name,
				s.logo,
				c.name AS course_name,
				cou.name AS school_country,
				cou.country_id AS school_country_id,
				ci.name AS school_city
			FROM
				orders AS o,
				schools AS s,
				courses AS c,
				countries AS cou,
				cities AS ci,
				users AS u
			WHERE
				o.user_id = u.user_id
			AND
				o.school_id = s.school_id
			AND
				o.course_id = c.course_id
			AND
				s.city_id = ci.city_id
			AND
				cou.country_id = ci.country_id
			AND
				order_id = '.$order_id.'
		';
	$row_order = mysql_fetch_assoc(query($sql));



head_print("Order ".number_pad($order_id,5)." from ".$row_order['application_datetime']);
?>
            
            <h1>Order <?=number_pad($order_id,5)?></h1>
            
            
            
            <h2>Course Information</h2><br>
                        
            <img src="<?=HTML_BASE?>/uploads/logos/<?=$row_order['logo']?>" align="right" alt="<?=$row_order['name']?>" />
            
            School: <b><?=$row_order['school_name']?></b><br>
            Location: <?=$row_order['school_city']?>, <?=$row_order['school_country']?><br><br>
            Course: <b><?=$row_order['course_name']?></b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
            Tuition: <b>$<?=number_format($row_order['tuition'],2)?></b><br> 
            Start Date: <b><?=$row_order['start_date']?></b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            Duration: <b><?=$row_order['duration']?> weeks</b><br><br>
            
            
            <?php if ($row_order['housing']==1) { ?>
            <b>Information about school housing is requested.</b>
            <?php } ?>
            
            <br><br>
            <h2>Applicant Information</h2><br>
            
            Fisrt Name, Last Name:<br>
            <h3><?=$row_order['first_name']?> <?=$row_order['last_name']?></h3>
            
            <?=($row_order['married']==1)?"Married":"Single"?> <?=($row_order['gender']=='m')?"Male":"Female"?> from
            
            <?php
			$sql = "SELECT
						name
					FROM
						countries
					WHERE
						country_id = ".$row_order['hometown_country_id']."
					  ";
			$res_country = mysql_fetch_assoc(query($sql));
			
			echo $res_country['name'];
			?>
            <br>
            Date Of Birth: <?=date('Y/m/d',strtotime($row_order['date_of_birth']))?>,
            Phone Number: <?=$row_order['phone']?>
            
            <br><br>
            
            <h2>Contact Information</h2><br>
            
            <b>Street Address</b> <?=$row_order['street_address']?><br>
            
            <b>City</b> <?=$row_order['city']?><br>
            
            <b>State</b> <?=$row_order['state']?><br>
            
            <b>Zip Code</b> <?=$row_order['zipcode']?><br>
            
            <b>Country</b>
            <?php
			$sql = "SELECT
						name
					FROM
						countries
					WHERE
						country_id = ".$row_order['country_id']."
					  ";
			$res_country = mysql_fetch_assoc(query($sql));
			
			echo $res_country['name'];
			?><br><br>
            
            <b>Emergency Contact</b> <?=$row_order['emergency_contact']?>
            
            <br><br>
            
            <h2>Educational Background</h2><br>
            
            <b>Have you graduated from high school?</b><br>
			<small>Enter School Name and Year</small><br>
            <?=$row_order['high_school_name']?>,
            <?=$row_order['high_school_date']?>
            
            <br><br>

            <b>Have you graduated from college or university? </b><br>
			<small>Enter School Name and Year</small><br>
            <?=$row_order['university_name']?>,
			<?=$row_order['university_date']?>
            
            <br><br>
            <b>English Level</b><br>
                <input type="checkbox" disabled="disabled" <?=($row_order['english_level']==1)?"checked":""?> >
                Beginner
                <input type="checkbox" disabled="disabled" <?=($row_order['english_level']==2)?"checked":""?> >
                Elementary
                <input type="checkbox" disabled="disabled" <?=($row_order['english_level']==3)?"checked":""?> >
                Low Intermediate
                <input type="checkbox" disabled="disabled" <?=($row_order['english_level']==4)?"checked":""?> >
                High Intermediate
                <input type="checkbox" disabled="disabled" <?=($row_order['english_level']==5)?"checked":""?> >
                Advanced
                
            <br><br>
            
            <b>Have you taken the TOEFL within the past 2 years?</b><br>
            <small>Enter Test Date and Score</small><br>
			<?=$row_order['toefl']?>
            
            <br><br>

            <b>What are your plans after completing this course?</b><br>
                <input type="checkbox" disabled="disabled" <?=($row_order['future_plans']==1)?"checked":""?> >
                Study at University or College
                <input type="checkbox" disabled="disabled" <?=($row_order['future_plans']==2)?"checked":""?> >
                Return to my country
                <input type="checkbox" disabled="disabled" <?=($row_order['future_plans']==3)?"checked":""?> >
                Undecided
                <input type="checkbox" disabled="disabled" <?=($row_order['future_plans']==4)?"checked":""?> >
                Other
                        
            <br><br>
            
            <b>Who will financially support your study abroad?</b><br>
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==1)?"checked":""?> >
                Self-funded
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==2)?"checked":""?> >
                Family
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==3)?"checked":""?> >
                Company
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==4)?"checked":""?> >
                School
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==5)?"checked":""?> >
                Scholarship
                <input type="checkbox" disabled="disabled" <?=($row_order['finances']==6)?"checked":""?> >
                Other
            
            <br><br>
            
            <?php if ($row_order['school_country_id']==235) { // United States ?>
            
            <h2>Visa Information</h2><br>
            
            <table class="application" width="100%">
            <tr><td colspan="2" >
            
            <b>Are you currently in the U.S.?</b><br>
            <label>
            <input type="radio" disabled="disabled" <?=($row_order['in_us']==1)?"checked":""?> >
            Yes</label>
            <label>
            <input type="radio" disabled="disabled" <?=($row_order['in_us']==0)?"checked":""?> >
            No</label>
            
            </td></tr>
            
            <tr><td width="50%">
            <br>
            <b>Do you currently have a visa?</b><br>
              <label>
                <input type="radio" disabled="disabled" <?=($row_order['have_visa']==1)?"checked":""?> >
                Yes</label>
              <label>
                <input type="radio" disabled="disabled" <?=($row_order['have_visa']==0)?"checked":""?> >
                No</label>
            
            </td><td>
            
            <b>What is your visa / immigration status?</b><br>
            <?=$row_order['visa_type']?>
            
            </td></tr>
            
            <tr><td colspan="2">
            <b>Are you currently attending school in the U.S.?</b><br>
              <label>
                <input type="radio" disabled="disabled" <?=($row_order['attending_school']==1)?"checked":""?> >
                Yes</label>
              <label>
                <input type="radio" disabled="disabled" <?=($row_order['attending_school']==0)?"checked":""?> >
                No</label>
            
            </td></tr>
            
            <tr><td>
            <br>
            <b>Name of institution issued your I-20?</b><br>
            <?=$row_order['i20_institution']?>
            
            </td><td>
            <br>
            <b>SEVIS ID number of your current I-20?</b><br>
            <?=$row_order['i20_id']?>
            
            </td></tr>
            
            </table>
            <br><br>
            
            <?php } ?>
            
            
            
            
            
<?php
	foot_print(); 
?>